import {format} from "https://jspm.dev/timeago.js";
import json2json from "https://gitee.com/zhangweis/deno-report-tools/raw/master/json2json.ts";
import lodash from 'https://jspm.dev/lodash';
import { parse } from "https://deno.land/std/flags/mod.ts";
const {from='date', to='ago', padding="20"} = parse(Deno.args);
json2json(async (input:any)=>input.map((i:any)=>{
    let iPadding = Number(padding);
    let ago = format(lodash.get(i, from));
    if (iPadding) {
        ago = ago.padEnd(iPadding);
    }
    lodash.set(i, to, ago);
    return i;
}));